<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<link rel="stylesheet" href="css/form.css" />
</head>

<body>
	<div id="header-wrap" data-mn=0>
		<a href="###" data-link="safe" data-type="ico" class="left ico-m ico-left"></a>
		<h2>实名认证</h2>
	</div>
	<div class="" id="">
		<div class="tips">
			<div class="t-info">为了您的资金安全<br />在享受平台提供的理财服务之前需要实名认证</div>
			<div class="t-error"></div>
		</div>
		<form id="rz_1">
		<ul class="form-list">
			<li class="ico-m ico-pl ico-user-s" data-type="ico">
				<div class="fl-cont form-input">
					<input id="name" type="text" placeholder="请输入姓名" />
				</div>
			</li>
			<li class="ico-m ico-pl ico-id" data-type="ico">
				<div class="fl-cont form-input">
					<input id="id" type="text" placeholder="请输入身份证号" />
				</div>
			</li>
		</ul>
		<div class="">
			<a href="###" data-link="edit-id-2" class="btn b-red"><span id="check">实名认证</span></a>
			<a href="###" id="false" data-cookie="id,2,1" data-link="edit-id-3"  class="btn b-link">体验一下接口验证失败</a>
		</div>
		
		<div class="feed-info">
			<h2>富贵提示</h2>
			接口认证只有一次机会，请认真填写资料，如果未认证成功，您还可以采用<b style="color: #e73335">人工认证</b>的方式实名认证！点击上面的“体验链接”，可以模拟认证失败的情况。
		</div>
		</form>
		<form id="rz_2">
		<ul class="form-list">
			<li class="ico-m ico-pl ico-user-s" data-type="ico">
				<div class="fl-cont form-input">
					<input id="name" type="text" placeholder="请输入姓名" />
				</div>
			</li>
			<li class="ico-m ico-pl ico-id" data-type="ico">
				<div class="fl-cont form-input">
					<input id="id" type="text" placeholder="请输入身份证号" />
				</div>
			</li>
			<li class="ico-m ico-pl ico-camera" data-type="ico">
				<div class="fl-cont form-input">
					<input id="photo" type="file" placeholder="请上传手持证件的照片" />
				</div>
			</li>
		</ul>
		<div class="">
			<a href="###" data-link="edit-id-21" data-cookie="id,1,1"  class="btn b-red"><span id="check">人工实名认证</span></a>
		</div>
		<div class="feed-info" id="return">
			<h2>富贵提示</h2>
			DEMO版允许您再次体验<b style="color: #e73335">接口认证</b>！<br />
			<a href="###" id="false" data-cookie="id,,-1" data-link="edit-id"  class="btn b-link">回到接口认证的界面</a>
		</div>
		</form>
		<div id="rz_3">
		<ul class="form-list">
			<li class="ico-m ico-pl ico-user-s" data-type="ico">
				<div class="fl-cont">
					<b id="set_name"></b>
				</div>
			</li>
			<li class="ico-m ico-pl ico-id" data-type="ico">
				<div class="fl-cont">
					<b id="set_id"></b>
				</div>
			</li>
		</ul>
		</div>
		<div class="feed-info">
			<h2>如有疑问，请咨询...</h2>
			客服电话：400-105-8851<br />
			微信客服：wuyifugui(公众号)
		</div>
	</div>
	<script>
	$(function(){
	//初始化界面
		var uid = $.cookie("id");
		if(uid == 2){
			$("#rz_3").remove()
			$("#rz_1").remove()
		}else if(uid == 1){
			$("#rz_2").remove()
			$("#rz_1").remove()
		}else{
			$("#rz_3").remove()
			$("#rz_2").remove()
		}
		$("#set_name").text($.cookie("name_show"))
		$("#set_id").text($.cookie("id_show"))
		$("#check").on("click",function(){
			var name = $("#name").check({type:7});
			var id = $("#id").check({type:3});
			if(name == 0){
				$(".t-error").text("请输入有效姓名").fadeIn(100)
				$(".t-info").hide()
				reset_tip()
				return false
			}else if(id == 0){
				$(".t-error").text("请输入有效身份证号码").fadeIn(100)
				$(".t-info").hide()
				reset_tip()
				return false
			}else{
				var id_c = $("#id").val()
				$.cookie("id_code",id_c);
				var id_length = id_c.length;
				var re2;
				var id_show = "";
				switch (id_length){
					case 15:
					id_show = id_c.match(/^\d{6}/)+"******"+id_c.match(/\w{3}$/)
					case 18:
					id_show = id_c.match(/^\d{6}/)+"********"+id_c.match(/\d{4}$/)
					break;
					default:
					id_show = "火星的身份证吧？"
				}
				$.cookie("id_show",id_show)
				$("#set_id").text(id_show)
				
				var name_c = $("#name").val()
				$.cookie("name",name_c);
				var name_length = name_c.length;
				var re;
				var name_show = "";
				switch (name_length){
					case 4:
					re = /[\u4e00-\u9fa5]{2}$/;
					name_show = "**"+name_c.match(re)
					case 3:
					re = /[\u4e00-\u9fa5]{2}$/;
					name_show = "*"+name_c.match(re)
					break;
					case 2:
					re = /[\u4e00-\u9fa5]{1}$/;
					name_show = "*"+name_c.match(re)
					break;
					case 1:
					name_show = name_c
					break;
				}
				$.cookie("name_show",name_show)
				$("#set_name").text(name_show)
				$.cookie("id","1")
			}
		})
	})
	</script>	
</body>

</html>
